# -*- coding: utf-8 -*-
from typing import List

from core.dataClasses import StockTradeDataColumnName
from domain.transaction_data.repository.stock_repository import acquire_stock_list


def paddingExchangeFlag(stockList: List[str]) -> List[str]:
    """
    给股票代码添加交易所信息
    :param stockList:
    :return:
    """
    if not stockList:
        return None
    allStockListDf = acquire_stock_list()
    df = allStockListDf[allStockListDf[StockTradeDataColumnName.STOCK_CODE.value].isin(stockList) == True]
    if not df.empty:
        return df[StockTradeDataColumnName.STOCK_CODE_FULL.value].values
    return None


def reacquireStockList():
    """
    更新股票一览表
    :return:
    """
    acquire_stock_list(True)


if __name__ == "__main__":
    sl = [
        "000776", "600515", "601038"
    ]
    result = paddingExchangeFlag(sl)
    print(result)
